/*
 * Miya.com Inc.
 * Copyright (c) 2004-2018 All Rights Reserved.
 */
package com.miya.erpmofa.common.lang.response.order;

import com.miya.erpmofa.common.lang.response.BaseResponse;
import com.miya.erpmofa.common.lang.sign.MiyaSignature;
import lombok.Data;
import org.apache.commons.lang.StringUtils;

import java.util.HashMap;
import java.util.Map;

/**
 * 订单批量回写响应对象
 *
 * @author ${guanzhong}
 * @version $Id: OrderBatchInfo.java, v 0.1 2017年12月27日 下午2:52 Exp $
 */
@Data
@SuppressWarnings("unused")
public class OrderBatchInfo extends BaseResponse {

    private static final long serialVersionUID = 903680054391151765L;

    /**
     * 回写订单数
     */
    private Integer write_count;

    /**
     * 失败订单数
     */
    private Integer fail_count;

    /**
     * 失败原因
     */
    private String fail_reason;

    public String initSignContent() {
        Map baseMap = new HashMap();
        if (write_count != null) {
            baseMap.put("write_count", String.valueOf(write_count));
        }
        if (fail_count != null) {
            baseMap.put("fail_count", String.valueOf(fail_count));
        }
        if (StringUtils.isNotBlank(fail_reason)) {
            baseMap.put("fail_reason", fail_reason);
        }
        return MiyaSignature.getSignContent(baseMap);

    }

}
